#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    bool checkPerfectNumber(int num) {
        int add = 0;
        //cout << num % 1 << endl;
        for (int i = 1; i < num; i++)
        {
            if (num % i == 0)
            {
                //cout << i << " ";
                add += i;
            }
        }
        //cout << endl;
        //cout << add;
        return add == num;
    }
};